﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using Seesmic.Sdp.Extensibility;

namespace Seesmic.HelloTipi
{
    public class HelloTipiTimeLineItem : ITimelineItem
    {

        #region ITimelineItem Members

        public Uri AvatarUri
        {
            get { return new Uri(this.User.profile_image_url, UriKind.Absolute); }
        }

        public string Id
        {
            get;
            set;
        }

        public string Text
        {
            get;
            set;
        }

        public string Username
        {
            get { return this.User.screen_name; }
        }

        public DateTimeOffset DateTime
        {
            get;
            set;
        }

        public DateTimeOffset LocalDateTime
        {
            get
            {
                return this.DateTime.ToLocalTime();
            }
        }
        
        public GeoLocation GeoLocation
        {
            get
            {
                return null;
            }
        }

        public DataTemplate Template
        {
            get
            {
                return HelloTipiPlugin.TimelineItemTemplate;
            }
        }

        public DataTemplate NotificationTemplate
        {
            get
            {
                return HelloTipiPlugin.NotificationItemTemplate;
            }
        }
        #endregion


        public HelloTipiAccount Account
        {
            get;
            set;
        }        
        
        public PTiRouZ.Net.SilverLight.Api.HelloTipi.my_sites Site
        {
            get;
            set;
        }

        public PTiRouZ.Net.SilverLight.Api.HelloTipi.user User
        {
            get;
            set;
        }

        public string UsernamewithoutFamily
        {
            get { return HelloTipiPlugin.getUserNameOnly(this.User.screen_name); }
        }

        private Uri _source;

        public Uri Source
        {
            get
            {
                if (_source == null)
                    return new Uri(String.Format("http://{0}.hellotipi.com", HelloTipiPlugin.getFamilyNameOnly(this.User.screen_name)));
                else
                    return _source;
            }
            set { _source = value; }
        }

        public bool isFamilyTimeline
        {
            get;
            set;
        }

        public bool isPrivateTimeline
        {
            get;
            set;
        }

        public bool? isSent
        {
            get;
            set;
        }

    
    }
}
